let layer;
let form;
layui.use(['layer', 'form'], function () {
    layer = layui.layer
    form = layui.form

    form.verify({
        length: [/^[\S]{6,12}$/, '密码必须6-12位'],
        same: function (value) {
            if (value != $('.newPwd').val()) {
                return '确认密码和新密码不一致'
            }
        },
        diff: function (value) {
            if (value != $('oldPwd').val()) {
                return '原密码和新密码不能一致！'
            }
        }
    })
    $('form').on('submit', function (e) {
        e.preventDefault()

        let data = $(this).serialize()

        $.ajax({
            url: '/my/updatepwd',
            data: data,
            type: 'POST',
            success: function (res) {
                layer.msg(res.message)

            }
        })
    })


})